<%@ page language="java" contentType="text/html; charset=UTF-8"
    import="java.util.*" pageEncoding="UTF-8"%>
<%@ page language="java" import="java.sql.*" import="ibm.etp.bean.*"
	import="ibm.etp.test.*"%>
<%@ page import="ibm.etp.no5.Worker1"%>	
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查找</title>
</head>
<body bgcolor="#EEF2FB">
<div align="center">
<br>
  	<s:form action="foddepartment" method="POST" >
  	     <font size=5 style="color:#6666FF;font-family:华文行楷">输入部门ID:</font><input type ="text" name ="wid">
  	 <input type ="submit"value ="查询信息">
  	</s:form>
  	 </div>
  	<%
  	String s=(String)request.getAttribute("message");
  	if(s.equals("success")){ %>
  	  部门信息如下：<br/>
		部门ID：<s:property value="wid"/><br>
		部门号码：<s:property value="dpid"/><br/> 
		部门名称：<s:property value="dpname"/><br/>
		部门经理：<s:property value="dpmanager"/><br/>
        部门员工信息
<%		
		try{
		String wid=(String)request.getAttribute("wid")+'%';
			
     List  list = HibernateOracle.doHibernateOr("from Worker as worker where worker.wid like '" + wid + "'");
   
     out.println("<table border=\"1\"><tr><th>工号</th><th>用户名</th><th>性别</th><th>地址</th></tr>");
    for(int i=0;i<list.size();i++){
	  Worker worker = (Worker)list.get(i);
	  //使用JavaBean
	  //Worker worker = new Worker();
      
  
	  out.print("<tr><td>"+worker.getWid()+"</td>");	 
	  out.print("<td>"+worker.getUsername()+"</td>"); 
	  out.print("<td>"+worker.getSex()+"</td>");
	  out.print("<td>"+worker.getAddress()+"</td>"); 
  }
  }catch(Exception e){
	  e.printStackTrace();
  }
  %>	
    <%}%>
  	<%
  	if(s.equals("error")){ %>
部门ID输入错误
     <%}%>
</body>
</html>